var api = 'http://47.97.8.254:8080/qk_code_api';
var localApi = "http://47.97.8.254:8080/QingKeExam";
//var localApi = "http://192.168.1.166:8080/QingKeExam";
//时间戳转化
function formatDate(nows) {
    var now = new Date(nows);
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    var date = now.getDate();
    var hour = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();
    return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
};
var origin = window.location.origin;
//用户退出
$(".sign-out").click(function(){
//	if (($("#my-confirm") != null) || ($("#my-confirm") != 'undefined')) {
//		$('#my-confirm .am-modal-hd').text("提示");
//		$('#my-confirm .am-modal-bd').text("你，确定要退出吗?");
//	} else{
    var notice = '<div class="am-modal am-modal-confirm" tabindex="-1" id="my-confirm-signout"><div class="am-modal-dialog">'+
        '<div class="am-modal-hd">提示</div><div class="am-modal-bd">你，确定要退出吗？</div>'+
        '<div class="am-modal-footer"><span class="am-modal-btn" data-am-modal-cancel>取消</span>'+
        '<span class="am-modal-btn" data-am-modal-confirm>确定</span></div></div></div>'
    $("body").append(notice);
//	}
    $('#my-confirm-signout').modal({
        relatedTarget: this,
        onConfirm: function(options) {
             window.location.href=origin+"/login.html";
        }
    });

});
var storage = window.localStorage;
var user_id = storage["uid"];
var class_id = storage["class_id"];
var user_name = storage["user_name"];
$('.user-panel-logged-in-text').text(user_name);
$(".userName").text(user_name);

$.ajaxSetup({
    xhrFields: {
        withCredentials: true
    },
    crossDomain: true,
    contentType: "application/x-www-form-urlencoded;charset=utf-8",
});
